package com.tiniplanet.webgate.entity;

import static javax.persistence.GenerationType.AUTO;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "WEB_ROLE")
public class Role extends AbstractModel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private long roleId;
	private String roleName;
	private Set<Credential> credential;

	/**
	 * @return the roleId
	 */
	@Id
	@GeneratedValue(strategy = AUTO)
	@Column(name = "ROLE_NO",nullable = false)
	public long getRoleId() {
		return roleId;
	}

	/**
	 * @param roleId
	 *            the roleId to set
	 */
	public void setRoleId(long roleId) {
		this.roleId = roleId;
	}

	/**
	 * @return the roleName
	 */
	@Column(name = "ROLE_NAME", nullable = false)
	public String getRoleName() {
		return roleName;
	}

	/**
	 * @param roleName
	 *            the roleName to set
	 */
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	/**
	 * @return the users
	 */
	@OneToMany(fetch = FetchType.EAGER, mappedBy = "role")
	public Set<Credential> getCredential() {
		return credential;
	}

	/**
	 * @param users
	 *            the users to set
	 */
	public void setCredential(Set<Credential> credential) {
		this.credential = credential;
	}

}
